<?php
include_once "../header1.php";
?>
<script type="text/javascript">
function getHttpRequest()
{
if(window.XMLHttpRequest)
{
xmlhttp=new XMLHttpRequest();
}
else
{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
return xmlhttp;
}
function showHint(str)
{
var xmlhttp;    
if (str=="")
  {
  document.getElementById("List").innerHTML="";
  return;
  }
if (window.XMLHttpRequest)
  {
  xmlhttp=new XMLHttpRequest();
  }
else
  {
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
   document.getElementById("List").innerHTML=xmlhttp.responseText;
    }
  }
  var sch_id=document.forms["DelTea"]["sch_id"].value;
  str=str+","+sch_id;
xmlhttp.open("GET","upp_tea_names.php?q="+str,true);
xmlhttp.send();
}
function fill(val)
{
document.DelTea.TeaName.value=val;
document.getElementById("List").innerHTML="";
}
</script>
<script type="text/javascript">
function DeleteVerification()
{
<?php
include_once ("../Login/databaseconnection.php");

if(!loggedin())
{
	require_once ("../index.php");
}
   
   else
   {
   ?>
var T_NIC_Number=document.forms["DelTea"]["TeaName"].value;

if (T_NIC_Number=="")
  {
  alert("Please select the teacher's Name!");
  return false;
  }
  
if (T_NIC_Number!="")
{
var r=confirm("Are you sure to delete this?");
if (r==true)
  {
  return true;
 
 }

if(r==false)
  {
   return false;
  }
}
}
</script>
</head>
<body>
<?php
include_once "../header2.php";
?>
<?php
include_once "topmenu.php";
?>
<div id="content">
	<div id="main">
	  <div id="bodyfield">
 <div id="lefttablereg">
<form  name="DelTea" action="#" method="POST" onSubmit="return DeleteVerification()">
<?php
if(isset($_POST['Delete']))
{
require_once 'del.php';
}
?>
  <table width="853" border="0" class="tablefontv">
    <tr>
      <td height="29" colspan="4"  scope="row" class="err">
      <?php
      if(isset($_POST['Delete']))
{
	if(isset($_SESSION['errorin']))
	{echo '<img src="../images/alert.jpg" width="12" height="12"/>';
		echo ($_SESSION['errorin']);
		unset($_SESSION['errorin']);
	}
	if(isset($_SESSION['error']))
	{echo '<img src="../images/alert.jpg" width="12" height="12"/>';
		echo ($_SESSION['error']);
		unset($_SESSION['error']);
	}
	if(isset($_SESSION['errornorow']))
	{echo '<img src="../images/alert.jpg" width="12" height="12"/>';
		echo $_SESSION['errornorow'];
		unset($_SESSION['errornorow']);
	}
	if(isset($_SESSION['errornot']))
	{echo '<img src="../images/alert.jpg" width="12" height="12"/>';
		echo $_SESSION['errornot'];
		unset($_SESSION['errornot']);
	}
	if(isset($_SESSION['errornot2']))
	{echo '<img src="../images/alert.jpg" width="12" height="12"/>';
		echo $_SESSION['errornot2'];
		unset($_SESSION['errornot2']);
	}
	if(isset($_SESSION['errorrd']))
	{echo '<img src="../images/alert.jpg" width="12" height="12"/>';
		echo $_SESSION['errorrd'];
		unset($_SESSION['errorrd']);
	}
	if(isset($_SESSION['errorrt']))
	{echo '<img src="../images/alert.jpg" width="12" height="12"/>';
		echo $_SESSION['errorrt'];
		unset($_SESSION['errorrt']);
	}
}   
?>
</td>
      </tr>
    
    <tr>
      <th width="159" height="29"  scope="row" bgcolor="#6AB5FF">Teacher's Name:</th>
      <td width="173" bgcolor="#999999">
	  <?php
	   $hin=$_SESSION['NIC_Number'].",".$_SESSION['Access_Type'];
		   echo "<input type='hidden' size='1' id='sch_id' name='sch_id' value='$hin'/>";
		
	 if(isset($_POST['Delete']))
	{
	$Teac_name=$First_Name." ".$Last_Name;
	 }
	  echo "<input type='text' id='TeaName' name='TeaName' onKeyUp='showHint(this.value)' value='$Teac_name' onClick='cleartbox()' size='35'/>";
	  ?>
	  </td>
      <td width="103" bgcolor="#6AB5FF">&nbsp;</td>
      <td width="400">&nbsp;</td>
    </tr>
    <tr>
      <th height="29" colspan="3" bgcolor="#6AB5FF"  scope="row"><a href="deltea.php" class="reset">Reset</a>|
        <input name="Delete" align="middle" type="submit" value="Delete" class="buttonok"/></th>
      <td>&nbsp;</td>
    </tr>
  </table>

  <br/>
  <br/>
   </form>
  <?php
   	   if(isset($_POST['Delete']))
{
	 $T_NIC_Number=$_POST['T_NIC_Number'];
	  if($_SESSION['Access_Type']=="Administrator"||$_SESSION['Access_Type']=="Teacher in Charge")
   {
	   if($T_NIC_Number!="Select One"&&$School_Id!=""&&$First_Name!=""&&$Gender!=""&&$Last_Name!="")
   {  
    echo '<table width="458" border="0" class="tablefontv">';
	        echo '<tr>';
        echo '<th width="200" height="44" scope="row">';
		echo "Teacher's NIC Number:";
		echo '</th>';
        echo '<td width="144">';
		echo "<input type='text' name='T_NIC_Number' value='$T_NIC_Number' />";
		echo '</td>';
		echo '<th height="44" scope="row">';
		echo "Appointment Date:"; 
		echo '</th>';
        echo '<td>';
		echo "<input type='text' name='Appointment_Date' value='$Appointment_Date' />";
		echo '</td>';
		  echo '<th height="44" scope="row">';
		echo "Appointed Subject:"; 
		echo '</th>';
        echo '<td>';
		echo "<input type='text' name='Appointed_Subject' value='$Appointed_Subject' />";
		echo '</td>';
      echo '</tr>';
	 echo '<tr>';
        echo '<th height="44" scope="row">';
		echo "School Id:";
		echo '</th>';
        echo '<td>';
		echo "<input type='text' name='School_Id' value='$School_Id' />";
		echo '</td>';
		echo '<th height="44" scope="row">';
		echo "Home Telephone Number:"; 
		echo '</th>';
        echo '<td>';
		echo "<input type='text' name='Home_Tp_Number' value='$Home_Tp_Number' />";
		echo '</td>';
		 echo '<th height="44" scope="row">';
		echo "Office Telephone Number:"; 
		echo '</th>';
        echo '<td>';
		echo "<input type='text' name='Office_Tp_Number' value='$Office_Tp_Number' />";
	echo '</td>';
      echo '</tr>';
	 echo '<tr>';
        echo '<th height="44" scope="row">';
		echo "First Name:";
		echo '</th>';
        echo '<td>';
		echo "<input type='text' name='First_Name' value='$First_Name' />";
		echo '</td>';
		 echo '<th height="44" scope="row">';
		echo "Address:"; 
		echo '</th>';
        echo '<td>';
	echo "<input type='text' name='Address' value='$Address' />";		
		echo '</td>';
		echo '<th height="44" scope="row">';
		echo "Mobile Telephone Number:"; 
		echo '</th>';
        echo '<td>';
		echo "<input type='text' name='Mobile_Tp_Number' value='$Mobile_Tp_Number' />";
		echo '</td>';
      echo '</tr>';
      echo '<tr>';
        echo '<th height="44" scope="row">';
		echo "Last Name :";
		echo "</th>";
       echo '<td>';
	   echo "<input type='text' name='Last_Name' value='$Last_Name' />";
	   echo '</td>';
	    echo '<th height="44" scope="row">';
		echo "Nature Of Appointment:"; 
		echo '</th>';
        echo '<td>';
		echo "<input type='text' name='Nature_Of_Appointment' value='$Nature_Of_Appointment' />";
		echo '</td>';
		 echo '<th height="44" scope="row">';
		echo "Professional Qualifications:"; 
		echo '</th>';
        echo '<td>';
		?>
		<textarea name='Professional_Qualifications'/><?php echo $row['Professional_Qualifications']; ?></textarea>
		<?php
	echo '</td>';
      echo '</tr>';
      echo '<tr>';
        echo '<th height="44" scope="row">';
		echo "Date of Birth:"; 
		echo '</th>';
        echo '<td>';
		echo "<input type='text' name='Date_Of_Birth' value='$Date_Of_Birth' />";
		echo '</td>';
		echo '<th height="44" scope="row">';
		echo "Acadamic Qualifications:"; 
		echo '</th>';
        echo '<td>';
		?>
		<textarea name='Acadamic_Qualifications'/><?php echo $row['Academic_Qualifications'];?></textarea>
		<?php
		echo '</td>';
		 echo '</tr>';
      echo '<tr>';
        echo '<th height="44" scope="row">';
		echo "Gender:"; 
		echo '</th>';
        echo '<td>';
			echo "<input type='text' name='Gender' value='$Gender' />";
			echo '</td>';
			echo '<th height="44" scope="row">';
		echo "Service:"; 
		echo '</th>';
        echo '<td>';
		echo "<input type='text' name='Service' value='$Service' />";
		echo '</td>';
      echo '</tr>';
        echo '</table>';
	}
	}	
	}
    ?>
	 </div>
 <div id="righttablereg">
  <div class="suggestionListsch" id="List"></div>
 </div>
</div>
</div>
</div>
<div id="sidebar">
<br/>
<div id="partners" class="boxed">
			<h2 class="title">TEACHERS</h2>
            </div> 
<?php
include_once "menu.php";
?>
<?php
include_once "../footer.php";
?>
<?php

}
?>
</body>
</html>